<?php defined('IN_YuLin') || exit('NO PERMIT!'); ?>
{template index/header}
<style>
a{cursor: pointer;}
p{font-size:12px;}
.type-choose{
	text-align: center;
    height: 32px;
    line-height: 32px;
    color: #333;
    background: #fefefe;
    border: 1px solid #e9e9e9;
    padding: 2 10px;
    margin-right: 8px;
    min-width: 64px;
    border-radius: 3px;
}
</style>
	<div class="subnav">
		<a href="">首页</a> &gt; <a href="">系统管理</a> &gt; <a href="">域名管理</a>
	</div>
	
	<div class="main-inner">
		<div class="x-body">
			<div class="formlist" style="border:0px;">
				<div class="formbox">
					<ul class="boxlist">
						<li class="fix">
							<span style="float:left;margin-left:20px;">域名</span> 
							<input type="text" class="w300 domain" value="" placeholder="如：xxx.com(不需要加www.与m.)">
							<span style="color:red;font-size:13px;margin-left:20px;">域名不能为空</span>
						</li>
						<li class="fix">
							<span style="float:left;margin-left:20px;">备注</span> 
							<input type="text" class="w300 remark" value="">
						</li>
						<li class="fix">
							<span style="float:left;margin-left:20px;">类型</span> 
							<a href="javascript:void(0);" id="front" class="type-choose" onclick="front()">前台<a>
							<a id="back" class="formBtn active" style="margin-left: -20px;" onclick="back()">后台<a>
							
						</li>
					</ul>	
				</div>
				<div class="formbox fix">
            		<a class="formBtn active saveBtn">提交保存</a> <a href="?m=system&c=binddomain" class="formBtn">返回上一页</a>
            	</div>
            	<div style="width:100%;float:left;margin-top:-80px; ">
            		<p style="color: #777;padding-left:10px;font-size:13px;line-height:20px;">* 添加前请先做好域名解析。<br/>
            		* 前台网址只需添加主网址（不需要添加www.与m.），前台最多只允许添加50条；后台最多只允许添加2条，且必须是二级域名。</p>
        		</div>
			</div>
			 
		</div>
	</div>
	<script type="text/javascript">
		$(function(){
			var wid = 2;

			$("#front").on('click',function(){
				wid = 1;
				$(this).removeClass("type-choose").addClass("formBtn active");
				$("#back").removeClass("formBtn active").addClass("type-choose");
			});

			$("#back").on('click',function(){
				wid = 2;
				$(this).removeClass("type-choose").addClass("formBtn active");
				$("#front").removeClass("formBtn active").addClass("type-choose");
			})

			$(".saveBtn").on('click',function(){
				var domain = $(".domain").val().replace(/\s/g,''), remark = $(".remark").val();
				if(!domain.length){
					alert('域名不能为空');return;
				}
				$.ajaxSetup({async:false});
				$.post("?m=system&c=domain_add&a=add",{domain:domain,remark:remark,wid:wid},function(res){
					res = eval('('+res+')');
					alert(res.msg);
					window.location.reload();
				});
			})			
		});
	</script>
{template index/footer}